# !/usr/bin/env python
# encoding: utf-8
'''
  @author: HJW
  @license: (C) Copyright 2013-2017, Node Supply Chain Manager Corporation Limited.
  @contact: hejunwang01@126.com
  @file: serializer.py
  @time: 2023/3/26 0026 下午 15:23
  @desc:
  '''

from rest_framework_simplejwt.serializers import TokenObtainPairSerializer

class MyTokenObtainPairSerializer(TokenObtainPairSerializer):
    @classmethod
    def get_token(cls, user):
        token = super().get_token(user)
        # 可以在token中添加自定义的payload
        token['username'] = user.username
        token['password'] = user.password
        print(token)

        return token

